package com.twu.biblioteca;

/**
 * Created by admin on 14-6-22.
 */
public class User {
    private final String name;
    private final String email;
    private final String phone;
    private final String libNum;
    private final String password;
    private boolean flag = false;

    public User(String name, String email, String phone, String libNum, String password) {
        this.name = name;
        this.email = email;
        this.phone = phone;
        this.password = password;
        this.libNum = libNum;
    }

    public boolean isLogin() {
        return flag;
    }

    public boolean login(String libNum, String password) {
        Biblioteca biblioteca = new Biblioteca();
        flag = biblioteca.check(libNum, password);
        return flag;
    }

    public String getUserInfo() {
        if(flag)
            return "name: " + name + ", email address: " + email + ", phone number: " + phone;
        return "Please Login in!";
    }

    public String getName() {
        return name;
    }

    public String getPassword() {
        return password;
    }

    public String getLibNum() {
        return libNum;
    }
}
